import '../public.dart';

class RegisterApi {
  /// 找回密码-重置密码
  /// /regist/resetPassword
  static Future<BaseResponse<void>> resetClientUserPassword(
    ResetClientUserPasswordDto params,
  ) async {
    final response = await HttpUtil().request(
      '/regist/resetPassword',
      method: 'POST',
      data: params.toJson(),
    );
    return BaseResponse<void>.fromJson(response);
  }

  /// 找回密码-获取邮件验证码
  /// /regist/getVerifyCodeForPwd
  static Future<BaseResponse<void>> getVerifyCodeForPwd(
    VerifyCodeForPwdDto params,
  ) async {
    final response = await HttpUtil().request(
      '/regist/getVerifyCodeForPwd',
      method: 'POST',
      data: params.toJson(),
    );
    return BaseResponse<void>.fromJson(response);
  }

  /// 注册-获取邮件验证码
  /// /regist/getVerifyCodeByEmail
  static Future<BaseResponse<void>> getVerifyCodeByEmail(
    EmailDto params,
  ) async {
    final response = await HttpUtil().request(
      '/regist/getVerifyCodeByEmail',
      method: 'POST',
      data: params.toJson(),
    );
    return BaseResponse<void>.fromJson(response);
  }

  /// 用户注册
  /// /regist/create
  static Future<BaseResponse<void>> create_2(ClientUserRegistDto params) async {
    final response = await HttpUtil().request(
      '/regist/create',
      method: 'POST',
      data: params.toJson(),
    );
    return BaseResponse<void>.fromJson(response);
  }

  /// 推荐码验证
  /// /regist/checkReferralCode/{referralCode}
  static Future<BaseResponse<bool>> checkReferralCode() async {
    final response = await HttpUtil().request(
      '/regist/checkReferralCode/{referralCode}',
      method: 'GET',
    );
    return BaseResponse<bool>.fromJson(
      response,
      fromJsonT: (json) => json['content'],
    );
  }
}
